home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shs_flower.cog < prev    next >
Text File  |  1999-11-15  |  33KB  |  1,327 lines

  1. # Jones 3D Cog Script
  2. #
  3. # shs_flower.cog
  4. #
  5. # Grow the flower
  6. #
  7. # [JWC] [MDR] [RT]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================
  11.  
  12. symbols
  13.  
  14. message    startup
  15. message    activated
  16. message    entered
  17. message    exited
  18. message    damaged
  19. message    callback
  20.  
  21. # ***************************** LINKED GEOM ******************************
  22.  
  23. surface    wet_snd_0            nolink
  24. surface    wet_snd_1            nolink
  25. surface    wet_snd_2            nolink
  26.  
  27. surface    wet_surf_0            nolink
  28. surface    wet_surf_1            nolink
  29. surface    wet_surf_2            nolink
  30. surface    wet_surf_3            nolink
  31. surface    wet_surf_4            nolink
  32. surface    wet_surf_5            nolink
  33. surface    wet_surf_6            nolink
  34. surface    wet_surf_7            nolink
  35. surface    wet_surf_8            nolink
  36. surface    wet_surf_9            nolink
  37. surface    wet_surf_10            nolink
  38. surface    wet_surf_11            nolink
  39. surface    wet_surf_12            nolink
  40. surface    wet_surf_13            nolink
  41.  
  42. # ******************************** THINGS ********************************
  43.  
  44. thing    t_player            local
  45. thing    t_Sender            local
  46. thing    t_PlantCurrent=-1    local
  47. thing    t_PlantNew=-1        local
  48. thing    nextPositionGhost    local
  49.  
  50. thing    flower_indy            # actor
  51. thing    statue_indy            # actor
  52.  
  53. thing    pot
  54. thing    pot_topchain_a        nolink
  55. thing    pot_topchain_b        nolink
  56. thing    pot_botchain_a        nolink
  57. thing    pot_botchain_b        nolink
  58. thing    pot_top
  59. thing    pad
  60. thing    shutter                nolink
  61. thing    statue
  62. thing    gate                nolink
  63. thing    sunlight            nolink
  64. thing    pot_upperchain        nolink
  65.  
  66. thing    potcam_1            nolink
  67. thing    potcam_2            nolink
  68. thing    potcam_3            nolink
  69. thing    potcam_6            nolink
  70. thing    pot_ct_1            nolink
  71. thing    pot_ct_2            nolink
  72.  
  73. thing    closeupcam_1        nolink
  74.  
  75. thing    close_ct_1            nolink
  76. thing    close_ct_2            nolink
  77. thing    close_ct_3            nolink
  78.  
  79. thing    statuecam_1            nolink
  80. thing    statuecam_1a        nolink
  81.  
  82. thing    statuecam_2            nolink
  83. thing    statuecam_2a        nolink
  84. thing    statue_ct_1            nolink
  85. thing    statue_ct_1a        nolink
  86. thing    statue_ct_1b        nolink
  87. thing    statue_ct_2            nolink
  88. thing    statue_ct_2a        nolink
  89.  
  90. thing    whipcam_1            nolink
  91. thing    whipcam_2            nolink
  92.  
  93. thing    pushGhost0            nolink
  94. thing    pushGhost1            nolink
  95. thing    pushGhost2            nolink
  96. thing    pushGhost3            nolink
  97. thing    pushGhost4            nolink
  98. thing    pushGhost5            nolink
  99. thing    pushGhost6            nolink
  100. thing    pushGhost7            nolink
  101.  
  102. thing    plant_Mark1            nolink
  103. thing    plant_Mark2            nolink
  104.  
  105. thing    plant_Cam1            nolink
  106. thing    plant_Cam2            nolink
  107.  
  108. thing    waterONpos            
  109.  
  110. # ****************************** TEMPLATES *******************************
  111.  
  112. template    t_plantType0=bulb                local    # bulb
  113. template    t_plantType1=plant                local    # bud
  114. template    t_plantType2=bud                local    # leafy bud
  115. template    t_FairyDust=shs_flowerdust        local
  116.  
  117. # ****************************** KEYFRAMES *******************************
  118.  
  119. keyframe    sh_open=shs_shtr_light.key        local
  120. keyframe    sh_close=shs_shtr_lightr.key    local
  121. keyframe    in_putbud=in_place_bulba.key    local
  122. keyframe    in_putplant=in_place_bulbb.key    local
  123. keyframe    in_pushstatue=in_push_post.key    local
  124. keyframe    in_nomove=in_push_nomove.key    local
  125. keyframe    in_GetPlant=in_reach_bulb.key    local
  126. keyframe    in_HandHip=0in_stand1_bd_4.key    local
  127. keyframe    in_bothup=0in_armsup_1_1.key    local
  128.  
  129.  
  130. # ******************************** MODELS ********************************
  131.  
  132. model    hand0=hand_in_bulb.3do                local
  133. model    hand1=hand_in_leaf.3do                local
  134. model    hand2=hand_in_bud.3do                local
  135.  
  136. # ********************************* COGS *********************************
  137.  
  138. cog        NoWorkTalkcog
  139. cog        HintCog
  140.  
  141. # ******************************** SOUNDS ********************************
  142.  
  143. sound    pot_move=shs_chain.wav                        local
  144. sound    h2o_on=shs_h2odrain_c.wav                    local
  145. sound    pad_stop=nub_croc_stop_c.wav                local
  146. sound    pad_move=sol_minecar_clatter.wav            local
  147. sound    shutter_move=sol_minecar_screech_rail3.wav    local
  148. sound    statue_stop=shs_statue_stop.wav                local
  149.  
  150. # music cues
  151. sound    music1=mus_shs_indysunlight.wav                local
  152. sound    music2=mus_shs_plantdescend.wav                local
  153. sound    music3=mus_shw_monkchant2.wav                local
  154. sound    music4=mus_gen_magic2.wav                    local
  155.  
  156. # dialog
  157. sound    in_flowerpot=ss07j04.wav                    local
  158. sound    in_nobudge=INXJ098.wav                        local
  159.  
  160. sound    in_foundSnd1=SS07J02.wav                    local # Plant
  161. sound    in_foundSnd2=SS07J03.wav                    local # Bud
  162. sound    in_hintSnd=SS07J08.wav                        local
  163. sound    in_clue=INXJ050.wav                            local
  164.  
  165. # wrong spot...
  166. sound    in_wrongspot0=Inxj219.wav                    local # Not lined up right
  167. sound    in_wrongspot1=Inxj220.wav                    local # Need to line up
  168. sound    in_wrongspot2=Inxj221.wav                    local # Need to move over.
  169. sound    in_wrongspot3=Inxj222.wav                    local # Not quite in position.
  170. sound    in_wrongspot4=Inxj223.wav                    local # Need to get in position.
  171. sound    in_wrongspot5=Inxj224.wav                    local # Need to find better spot.
  172.  
  173.  
  174. # **************************** PZL STATE VARS ****************************
  175.  
  176. int        n_StatuePos=0        local
  177. int        n_PotLowered=0        local
  178. int        n_PlantInPot=0        local
  179. int        n_WaterOn=0            local
  180. int        n_ShutterOpen=0        local
  181. int        n_CurItem=0            local
  182.  
  183. int        n_PlantState=0        local    # 0 = bulb, 1 = bud, 2 = leafy bud
  184. int        n_GrowMethod=0        local    # 1 = water, 2 = light
  185.  
  186. int        n_plantBin_ID0=104    local    # bulb
  187. int        n_plantBin_ID1=105    local    # bud
  188. int        n_plantBin_ID2=106    local    # leafy bud
  189.  
  190. int        b_Solved=0            local
  191. int        b_Spoken=0            local
  192. int        bFound=0            local
  193.  
  194. # *************************** MISC LOCAL VARS ****************************
  195.  
  196. int        n_idx                local
  197.  
  198. int        pushType=0            local    # 0 = None, 1 = Push, -1 = No move
  199. int        pushPosition=0        local
  200.  
  201. int        pickupSide            local    # 0 = In front of pot, 1 = In water
  202.  
  203. int        shutterTrack        local
  204.  
  205. int        in_rotrate            local
  206. int        in_KeyTrack            local
  207.  
  208. int        bCutsceneRunning=0    local
  209.  
  210. int        callbackNum            local
  211. int        in_swapRef            local
  212.  
  213. int        curCam                local
  214.  
  215. int        potloop                local    # allow sound to loop
  216. int        h2oloop                local
  217.  
  218. int        played=0            local    # vars for randlocationlines
  219. int        doplay                local
  220. int        cursound            local
  221. int        l_newline=50        local
  222. int        l_oldline=50        local
  223.  
  224.  
  225. flex    dotProduct            local
  226. flex    rightDot            local
  227. flex    indyDistance        local
  228. flex    camXOffset            local
  229.  
  230. sector    curSector            local
  231.  
  232. vector    indyVector            local
  233. vector    endCamPos            local
  234. vector    playerPos            local
  235. vector    thingPos            local
  236. vector    createPos            local
  237.  
  238. # *************************** SUBROUTINES ****************************
  239.  
  240. flex    nomove                local
  241. flex    wateron                local
  242. flex    showgate            local
  243. flex    checkpuzzlestatus    local
  244. flex    placeplant            local
  245. flex    lowerpot            local
  246. flex    flowercloseup        local
  247. flex    removeplant            local
  248. flex    GetPotSide            local
  249. flex     randlocationlines    local
  250.  
  251. end
  252.  
  253. # ========================================================================
  254. code
  255.  
  256. startup:
  257.  
  258.     sleep(.01);
  259.  
  260.     t_player = GetLocalPlayerThing();
  261.     curCam = GetCurrentCamera();
  262.  
  263.     # Must set bits on in marcus and clear in startup
  264.     # make water surface invisible
  265.     for (n_idx = 0; n_idx < 14; n_idx = n_idx + 1)
  266.     {
  267.         SetFaceGeoMode(wet_surf_0[n_idx], 0);
  268.     }
  269.  
  270.     # attach pot parts
  271.     AttachThingToThing(pot_topchain_a, pot);
  272.     AttachThingToThing(pot_topchain_b, pot);
  273.     AttachThingToThing(pot_botchain_a, pot);
  274.     AttachThingToThing(pot_botchain_b, pot);
  275.     AttachThingToThing(pot_top, pot);
  276.     AttachThingToThing(pot_upperchain, pot);
  277.  
  278.     # Make sure nothing gets stuck 
  279.     SetCollideType(pot_topchain_a, 0);
  280.     SetCollideType(pot_topchain_b, 0);
  281.     SetCollideType(pot_botchain_a, 0);
  282.     SetCollideType(pot_botchain_b, 0);
  283.     SetCollideType(pot_top, 0);
  284.     SetCollideType(pot_upperchain, 0);
  285.  
  286.     # move pot to top room
  287.     MoveToFrame(pot, 1, 20);
  288.     WaitForStop(pot);
  289.  
  290.     # Give collision
  291.     SetCollideType(pot_topchain_a, 3);
  292.     SetCollideType(pot_topchain_b, 3);
  293.     SetCollideType(pot_botchain_a, 3);
  294.     SetCollideType(pot_botchain_b, 3);
  295.     SetCollideType(pot_top, 3);
  296.     SetCollideType(pot_upperchain, 3);
  297.  
  298.     # make non-visible parts out-of-play.
  299.     SetThingFlags(pot_topchain_a, 0x80000);
  300.     SetThingFlags(pot_topchain_b, 0x80000);
  301.     SetThingFlags(pot_top, 0x80000);
  302.     SetThingFlags(pot_upperchain, 0x80000);
  303.     SetThingFlags(sunlight, 0x80000);
  304.     SetThingAlpha(sunlight, 0.0);
  305.  
  306.     # Remember Indy's rotation rate
  307.     in_rotRate = GetThingMaxRotVel(statue_indy);
  308.  
  309.     # Give it some light
  310.     SetThingLight(pad, '.2 .2 .2', .01, .01);
  311.     SetThingLight(shutter, '.2 .2 .2', .01, .01);
  312.     SetThingLight(pot, '.2 .2 .2', .1, .01);
  313.     SetThingLight(pot_top, '.3 .3 .3', .1, .01);
  314.  
  315.     ####### TEMP #######
  316.  
  317.     #ChangeInv(t_player, n_plantBin_ID0, 1.0);
  318.     #SetInvAvailable(t_player, n_plantBin_ID0, 1);
  319.  
  320.     ####################
  321.  
  322.     return;
  323.  
  324. # ........................................................................
  325.  
  326. activated:            
  327.  
  328.     if (bCutsceneRunning)
  329.         return;
  330.  
  331.     t_Sender = GetSenderRef();
  332.  
  333.     if (t_Sender == statue)    # Handle Statue logic
  334.     {
  335.         playerPos = GetThingPos(t_player);
  336.         thingPos = GetThingPos(statue);
  337.  
  338.         indyDistance = VectorDist(thingPos, playerPos); # How far away is Indy from the statue?
  339.         if (indyDistance > 0.25) # Magic number
  340.             return;
  341.  
  342.         # Compute vector from statue to Indy
  343.         indyVector = VectorNorm(VectorSub(thingPos, playerPos));
  344.  
  345.         # Check to see where Indy is standing relative to the statue
  346.         dotProduct = VectorDot(GetThingLVec(statue), indyVector);
  347.         rightDot = VectorDot(GetThingRVec(statue), indyVector);
  348.  
  349.         pushType = 0;
  350.  
  351.         if (ABS(dotProduct) <= 0.5)
  352.         {
  353.             #DEBUGFLEX(dotProduct, "Dot product:");
  354.             #DEBUGFLEX(rightDot, "Right dot:");
  355.             # We're within 45 degrees of one of the handles...
  356.             if (dotProduct > 0.25 && rightDot < -0.5)
  357.             {
  358.                 # Indy is behind the right handle
  359.                 pushType = 1;
  360.                 pushPosition = 0;
  361.             }
  362.             else if (dotProduct < -0.18 && rightDot < -0.5)
  363.             {
  364.                 # Indy is in front of the right handle
  365.                 pushType = -1;
  366.                 pushPosition = 1;
  367.             }
  368.             else if (dotProduct < -0.26 && rightDot > 0.5)
  369.             {
  370.                 # Indy is in front of the left handle
  371.                 pushType = 1;
  372.                 pushPosition = 4;
  373.             }
  374.             else if (dotProduct > 0.18 && rightDot > 0.5)
  375.             {
  376.                 # Indy is in behind the left handle
  377.                 pushType = -1;
  378.                 pushPosition = 5;
  379.             }
  380.         }
  381.         # If Indy's not in a valid spot, bail
  382.         if (!pushType)
  383.             return;
  384.  
  385.         # Prep for push statue
  386.         StartCutscene(1);
  387.         bCutsceneRunning = 1;
  388.         SetActorFlags(t_player, 0x200000);        # paralyze him
  389.         StopThing(t_player);
  390.  
  391.         # Compensate for statue rotation
  392.         pushPosition = (pushPosition + (n_StatuePos * 2)) % 8;
  393.  
  394.         # If the statue puzzle is already solved...
  395.         if (n_StatuePos > 1)
  396.         {
  397.             # Play no move animation
  398.             call NoMove;
  399.  
  400.             # "Won't budge..."
  401.             PlayVoice(t_player, in_nobudge, 1, 1);
  402.  
  403.             # We're done...
  404.             bCutsceneRunning = 0;
  405.             return;
  406.         }
  407.  
  408.         # If we're just on the wrong side...
  409.         if (pushType != 1)
  410.         {
  411.             # Play no move animation
  412.             call NoMove;
  413.  
  414.             # Play near miss line...
  415.             call randlocationlines;
  416.             
  417.             # We're done...
  418.             bCutsceneRunning = 0;
  419.             return;
  420.         }
  421.  
  422.         # Handy pointer to next push position ghost
  423.         nextPositionGhost = pushGhost0[(pushPosition + 2) % 8];
  424.  
  425.         # Remember current camera
  426.         curCam = GetCurrentCamera();
  427.  
  428.         # Set up ending camera position
  429.         endCamPos = GetThingPos(nextPositionGhost);
  430.         endCamPos = VectorAdd(VectorTransformToOrient(nextPositionGhost, '1.0 0.5 0.5'), endCamPos);
  431.  
  432.         # Teleport our actor Indy to the right mark
  433.         TeleportThing(statue_indy, pushGhost0[pushPosition]);
  434.  
  435.         # Prep
  436.         CopyPlayerHolsters(t_player, statue_indy);
  437.         SetThingFlags(t_player, 0x80000);        # hide him
  438.         ClearThingFlags(statue_indy, 0x80000);    # reveal our actor
  439.  
  440.         n_StatuePos = n_StatuePos + 1;
  441.  
  442.         if (n_StatuePos == 1)                       # water on
  443.         {
  444.             Call WaterOn;
  445.             n_WaterOn = 1;
  446.         }
  447.         else if ( n_StatuePos == 2 )            # gate open
  448.         {
  449.             Call ShowGate;
  450.         }
  451.  
  452.         call CheckPuzzleStatus;
  453.  
  454.         return;
  455.     }
  456.  
  457.     if (t_Sender == t_PlantCurrent)    # Pick up plant
  458.     {
  459.         # Stop player & take away control
  460.         if (MakeMeStop() == -1) return;
  461.         DeselectWeaponWait(t_player);
  462.  
  463.         # Cutscene spleef
  464.         curCam = GetCurrentCamera();
  465.         StartCutscene(1);
  466.         bCutsceneRunning = 1;
  467.  
  468.         call GetPotSide;
  469.  
  470.         # Prep Actor
  471.         CopyPlayerHolsters(t_player, flower_indy);
  472.         SetThingFlags(t_player, 0x80000);
  473.         TeleportThing(flower_indy, plant_Mark1[pickupSide]);
  474.         ClearThingFlags(flower_indy, 0x80000);
  475.         AISetLookThing(flower_indy, t_PlantCurrent);
  476.  
  477.         # Camera...
  478.         SetCameraFocus(2, plant_Cam1[pickupSide]);
  479.         SetCameraSecondaryFocus(2, plant_Mark1[pickupSide]);
  480.         SetCurrentCamera(2);
  481.         SetCameraFOV(40, 0, 0.0);
  482.  
  483.         # Check item status before we pick it up...
  484.         bFound = IsItemFound(n_plantBin_ID0[n_PlantState]);
  485.  
  486.         Sleep(0.33);
  487.         PlayKey(flower_indy, in_GetPlant, 5, 0x12, 0); 
  488.  
  489.         # Play voice, but only once
  490.         if (!bFound)
  491.         {
  492.             PlayVoice(flower_indy, in_foundSnd1[n_PlantState - 1], 1, 1);
  493.             if (n_PlantState == 1)
  494.             {
  495.                 Sleep(0.5);
  496.                 in_KeyTrack = PlayKey(flower_indy, in_HandHip, 5, 0x14, 0); 
  497.                 SetCameraFOV(30, 1, 2.0);
  498.                 PlayVoice(flower_indy, in_hintSnd, 1, 1);
  499.                 StopKey(flower_indy, in_KeyTrack, 0.5);
  500.             }
  501.             else if (n_PlantState == 2)
  502.             {
  503.                 SendMessage(HintCog, user2);
  504.             }
  505.         }
  506.         else
  507.         {
  508.             Sleep(1.75);
  509.         }
  510.  
  511.         # Pop Indy to actor location & let him go
  512.         Sleep(1.0);
  513.         CopyOrientAndPos(flower_indy, t_player);
  514.         SetThingFlags(flower_indy, 0x80000);
  515.         ClearThingFlags(t_player, 0x80000);
  516.         ClearActorFlags(t_player, 0x200000);
  517.  
  518.         # Cleanup
  519.         EndCutscene();
  520.         ResetCameraFOV(0, 0.0);
  521.         SetCurrentCamera(curCam);
  522.         bCutsceneRunning = 0;
  523.  
  524.         # Set puzzle vars
  525.         n_PlantInPot = 0;
  526.         t_PlantCurrent = -1;
  527.  
  528.         return;
  529.     }
  530.  
  531.     if (t_Sender == pot) # Handle pot logic
  532.     {
  533.         n_CurItem = GetCurItem(t_player);
  534.  
  535.         # Bail if no item is current
  536.         if (n_CurItem == 0)
  537.         {
  538.             if(!b_Spoken)
  539.             {
  540.                 b_Spoken = 1;
  541.  
  542.                 # Say the line if the pot is still up
  543.                 if (n_PotLowered == 0)
  544.                 {
  545.                     PlayVoice(t_player, in_flowerpot, 1, 1);
  546.                 }
  547.             }
  548.             return;
  549.         }
  550.  
  551.         # Is player placing plant into pot?
  552.         for (n_idx = 0; n_idx < 3; n_idx = n_idx + 1)
  553.         {
  554.             if (n_CurItem == n_plantBin_ID0[n_idx])
  555.             {
  556.                 n_PlantInPot = 1;
  557.  
  558.                 # Lose plant from Indy's inventory...
  559.                 ChangeInv(t_player, n_plantBin_ID0[n_idx], -1.0);
  560.  
  561.                 # Prep Indy
  562.                 if (MakeMeStop() == -1) return;
  563.  
  564.                 # Cutscene stuff
  565.                 StartCutScene(1);
  566.                 bCutsceneRunning = 1;
  567.                 DeselectWeaponWait(t_player);
  568.                 CopyPlayerHolsters(t_player, flower_indy);
  569.  
  570.                 # Create the plant
  571.                 call PlacePlant;
  572.  
  573.                 # What side are we on?
  574.                 call GetPotSide;
  575.  
  576.                 # Special case of 1st time placed... lower pot
  577.                 if (n_PotLowered == 0)
  578.                 {
  579.                     # Play cutscene
  580.                     Call LowerPot;
  581.  
  582.                     # update state of plant
  583.                     call CheckPuzzleStatus;
  584.  
  585.                     # Show change
  586.                     Call FlowerCloseup;
  587.  
  588.                     # cut back to Indy, camera swings back to return control
  589.                     SetCameraPosition(1, GetThingPos(potcam_6)); # prep for camera to swing back
  590.                     SetCameraLookInterp(2, 0); # kill pan & tilt mode
  591.                     SetCameraPosInterp(2, 0); # kill dolly mode
  592.                     Sleep(0.01);
  593.                     ResetCameraFOV(0, 0.0);
  594.                     SetCurrentCamera(curCam);
  595.  
  596.                     if (t_PlantNew != -1)
  597.                     {
  598.                         call RemovePlant;
  599.                         t_PlantCurrent = t_PlantNew;
  600.                         SetCollideType(t_PlantCurrent, 3);
  601.                         t_PlantNew = -1;
  602.                     }
  603.  
  604.                 }
  605.                 else
  606.                 {
  607.                     # Prep Actor
  608.                     CopyPlayerHolsters(t_player, flower_indy);
  609.                     SetThingFlags(t_player, 0x80000);
  610.                     TeleportThing(flower_indy, plant_Mark1[pickupSide]);
  611.                     ClearThingFlags(flower_indy, 0x80000);
  612.  
  613.                     # Prep camera
  614.                     curCam = GetCurrentCamera();
  615.                     SetCameraFocus(2, plant_Cam1[pickupSide]);
  616.                     SetCameraSecondaryFocus(2, plant_Mark1[pickupSide]);
  617.                     SetCurrentCamera(2);
  618.                     SetCameraFOV(40, 0, 0.0);
  619.  
  620.                     # Offset the camera
  621.                     #SetExtCamOffset('0.15 -0.05 0.04');
  622.                     #SetExtCamLookOffset('0.0 0.02 0.0');
  623.  
  624.                     # Start place plant animation
  625.                     Playkey(flower_indy, in_putplant, 5, 0x12, 1);
  626.                     Sleep(0.25);
  627.  
  628.                     # Restore camera
  629.                     ResetCameraFOV(0, 0.0);
  630.  
  631.                     # Pop player into position
  632.                     CopyOrientAndPos(flower_indy, t_player);
  633.  
  634.                     # Cleanup
  635.                     ResetCameraFOV(0, 0.0);
  636.                     SetCurrentCamera(curCam);
  637.                 }
  638.  
  639.                 SetThingFlags(flower_indy, 0x80000);
  640.                 ClearThingFlags(t_player, 0x80000);
  641.                 ClearActorFlags(t_player, 0x200000);
  642.                 bCutsceneRunning = 0;
  643.                 EndCutscene();
  644.  
  645.                 call CheckPuzzleStatus;
  646.                 return;
  647.             }
  648.         }
  649.         
  650.         # Call NoWorkTalkCog because player is trying to use an incorrect item.
  651.         Sleep(.3);
  652.         SendMessageEx(NoWorkTalkCog, user1, 0, 0, 0, 0);
  653.         global15 = 0; # per Randy
  654.         while (global15 == 0)
  655.             {
  656.                 Sleep(0.01); # wait for line to finish
  657.             }
  658.         
  659.     }
  660.  
  661.     return;
  662.  
  663. # ........................................................................
  664.  
  665. damaged:
  666.  
  667.     # check if whip strut
  668.     if (GetSenderRef() != pot_top) return;
  669.  
  670.     if (GetParam(1) == 0x10)
  671.     {
  672.         # Prep...
  673.         curCam = GetCurrentCamera();
  674.         ResetCameraFOV(0, 0.0);
  675.  
  676.         StartCutscene(1);
  677.  
  678.         # disable controls, switch camera
  679.         SetActorFlags(t_player, 0x200000);
  680.         SetCameraFocus(2, whipCam_1);
  681.         SetCameraSecondaryFocus(2, t_player);
  682.         SetCurrentCamera(2);
  683.         SetCameraFOV(70, 0, 0.0);
  684.  
  685.         # play music
  686.         PlaySoundLocal(music1, 1.0, 0, 0x0000, 0);
  687.     }
  688. return;
  689.  
  690. # ........................................................................
  691.  
  692. entered:
  693.  
  694.     # check if indy lands on pressure pad 
  695.     if (GetSenderRef() == pad)
  696.     {
  697.         if ((n_ShutterOpen != 0) || (n_PotLowered != 1))
  698.         {
  699.             return;
  700.         }
  701.  
  702.         # Prep
  703.         ResetCameraFOV(0, 0.0);
  704.         SetActorFlags(t_player, 0x200000);
  705.         DeselectWeapon(t_player);
  706.         TeleportThing(flower_indy, t_player);
  707.         AISetCutSceneMode(flower_indy);
  708.  
  709.         # Switch camera
  710.         SetCameraFocus(2, whipCam_1);
  711.         SetCameraSecondaryFocus(2, t_player);
  712.         SetCurrentCamera(2);
  713.         SetCameraFOV(70, 0, 0.0);
  714.  
  715.         n_ShutterOpen = 1;
  716.  
  717.         # move pad down
  718.         MoveToFrame(pad, 1, 2);
  719.         PlaySoundLocal(pad_move, 1.0, 0, 0x0, 0);
  720.         WaitForStop(pad);
  721.         PlaySoundLocal(pad_stop, 1.0, 0, 0x0, 0);
  722.         Sleep(.5);     # beat
  723.  
  724.         #cut to shutters
  725.         SetCameraFocus(2, whipcam_2);
  726.         SetCameraSecondaryFocus(2, shutter);
  727.  
  728.         # open shutters
  729.         PlaySoundLocal(shutter_move, 1.0, 0, 0x0, 0);
  730.         shutterTrack = PlayKey(shutter, sh_open, 4, 0x14, 0);
  731.         Sleep(0.33);
  732.  
  733.         # play light effect
  734.         SetThingLight(sunlight, '1 1 1', 2.0, .01);
  735.         SetThingLight(pad, '1 1 1', 4.0, .01);
  736.  
  737.         ClearThingFlags(sunlight,0x80000);
  738.         ThingFadeAnim(sunlight, 0, 1, 0.5, 0);
  739.  
  740.         # Turn Indy
  741.         CopyPlayerHolsters(t_player, flower_indy);
  742.         SetThingFlags(t_player, 0x80000);
  743.         ClearThingFlags(flower_indy, 0x80000);
  744.         AISetLookThing(flower_indy, pot);
  745.  
  746.         # Follow sunlight
  747.         SetCameraLookInterp(2, 1); # enable pan & tilt mode
  748.         SetCameraInterpSpeed(2, 3.0);
  749.         Sleep(0.33);
  750.         SetCameraSecondaryFocus(2, pot);
  751.         Sleep(3.5);
  752.  
  753.         # Update state
  754.         Call CheckPuzzleStatus;
  755.  
  756.         # Get rid of sunlight
  757.         ThingFadeAnim(sunlight, 1, 0, 0.1, 0);
  758.  
  759.         # Show change if puzzle's not already solved
  760.         if (!b_Solved)
  761.         {
  762.             Call FlowerCloseup;
  763.         }
  764.  
  765.         # Housekeeping...
  766.         SetCameraPosition(1, GetThingPos(whipcam_2));    # prep for camera to swing back
  767.         CopyOrientAndPos(flower_indy, t_player);
  768.         SetThingFlags(flower_indy, 0x80000);
  769.         ClearActorFlags(t_player, 0x200000);
  770.         ClearThingFlags(t_player, 0x80000); 
  771.         SetCameraLookInterp(2, 0); # kill pan & tilt mode
  772.         SetCameraPosInterp(2, 0); # kill dolly mode
  773.         Sleep(0.01);
  774.         SetCurrentCamera(curCam);
  775.         ResetCameraFOV(0, 0.0);
  776.         EndCutscene();
  777.  
  778.         if (t_PlantNew != -1)
  779.         {
  780.             call RemovePlant;
  781.             t_PlantCurrent = t_PlantNew;
  782.             SetCollideType(t_PlantCurrent, 3);
  783.             t_PlantNew = -1;
  784.         }
  785.     }
  786.     return;
  787.  
  788. # ........................................................................
  789.  
  790. exited:
  791.  
  792.     # See if Indy leaves pad
  793.     if (GetSenderRef() == pad)
  794.     {
  795.         if (n_ShutterOpen != 1)
  796.         {
  797.             return;
  798.         }
  799.         
  800.         # Wait a bit and see if Indy's just jumping up and down...
  801.         Sleep(0.75);
  802.         if (VectorZ(VectorSub(GetThingPos(t_player), '0.0 0.0 0.2')) >= VectorZ(GetThingPos(pad)))
  803.         {
  804.             return;
  805.         }
  806.  
  807.         # Move pad up
  808.         MoveToFrame(pad, 0, 3);
  809.         PlaySoundLocal(pad_move, 1.0, 0, 0x0, 0);
  810.         WaitForStop(pad);
  811.         PlaySoundLocal(pad_stop, 1.0, 0, 0x0, 0);
  812.  
  813.         # Close shutters
  814.         PlayKey(shutter, sh_close, 8, 0x12, 0);
  815.         StopKey(shutter, shutterTrack, 0.0);
  816.         Sleep(0.66);
  817.  
  818.         # Turn off light effect
  819.         SetThingFlags(sunlight, 0x80000);
  820.         SetThingLight(pad, '0 0 0', 0.0, .01);
  821.         
  822.         n_ShutterOpen = 0;
  823.     }
  824.  
  825.     return;
  826.  
  827. # ........................................................................
  828.  
  829. callback:
  830.  
  831.     callbackNum = GetParam(1);
  832.  
  833.     if (callbackNum == 21)
  834.     {
  835.         # Pull plant from pouch
  836.         in_swapRef = SetThingMesh(flower_indy, 15, hand0[n_PlantState], 0);
  837.     }
  838.     else if (callbackNum == 22) # Place plant
  839.     {
  840.         # Restore hand mesh
  841.         RestoreThingMesh(flower_indy, in_swapRef);
  842.  
  843.         # Light bud.  Heh.
  844.         ClearThingFlags(t_PlantCurrent, 0x80000);
  845.         SetThingLight(t_PlantCurrent, '1 1 1', .01, 0);
  846.     }
  847.     else if (callbackNum == 23)
  848.     {
  849.         # Take plant from pot
  850.         in_swapRef = SetThingMesh(flower_indy, 15, hand0[n_PlantState], 0);
  851.         call RemovePlant;
  852.     }
  853.     else if (callbackNum == 24)
  854.     {
  855.         ChangeInv(t_player, n_plantBin_ID0[n_PlantState], 1);
  856.         SetInvAvailable(t_player, n_plantBin_ID0[n_PlantState], 1);
  857.         JonesInvItemChanged(n_plantBin_ID0[n_PlantState]);
  858.  
  859.         # Restore hand mesh
  860.         RestoreThingMesh(flower_indy, in_swapRef);
  861.  
  862.         # Look up...
  863.         AISetLookThingEyeLevel(flower_indy, pot);
  864.     }
  865.     else if (callbackNum == 26)
  866.     {
  867.         # This callback comes from the statue push keyframe to let us know it's time to start rotating the statue.
  868.         Rotate(statue, -90, 1, 3.8); # spin statue
  869.     }
  870.  
  871.     return;
  872.  
  873. # ========================================================================
  874. #    Subroutines
  875. # ========================================================================
  876.  
  877. PlacePlant:
  878.  
  879.     #DEBUGFLEX(n_PlantState, "Created plant THING.  Current plant state is");
  880.  
  881.     if (t_PlantCurrent != -1)
  882.         DestroyThing(t_PlantCurrent);
  883.  
  884.     curSector = GetThingSector(pot);
  885.  
  886.     t_PlantCurrent = CreateThingatPos(t_plantType0[n_PlantState], curSector, GetThingPos(pot), '0 0 0');
  887.     CaptureThing(t_PlantCurrent);
  888.     AttachThingToThingEx(t_PlantCurrent, pot, 0x08);
  889.  
  890.     # Hide placed plant until the right moment
  891.     SetThingFlags(t_PlantCurrent, 0x80000);
  892.  
  893.     return;
  894.  
  895. # ........................................................................
  896.  
  897. RemovePlant:
  898.  
  899.     if (t_PlantCurrent != -1)
  900.     {
  901.         DetachThing(t_PlantCurrent);
  902.         DestroyThing(t_PlantCurrent);
  903.         t_PlantCurrent = -1;
  904.     }
  905.  
  906.     return;
  907.  
  908. # ........................................................................
  909.  
  910. CheckPuzzleStatus:
  911.  
  912.     if ( n_PlantInPot == 1 )
  913.     {
  914.         if ( n_PlantState == 0 )            # bulb
  915.         {
  916.             if ( n_ShutterOpen == 1 )         # using sunlight
  917.             {
  918.                 n_PlantState = 1;
  919.                 n_GrowMethod = 2;            # remember used sunlight
  920.             }
  921.  
  922.             if ( n_WaterOn == 1 )            # using    water
  923.             {
  924.                 n_PlantState = 1;
  925.                 n_GrowMethod = 1;            # remember used water
  926.             }
  927.         }
  928.  
  929.         if ( n_PlantState == 1 )        # bud
  930.         {
  931.             # Check what method was used and only allow the other
  932.  
  933.             if ( (n_GrowMethod==2) && (n_WaterOn==1) )
  934.             {
  935.                 n_PlantState = 2;
  936.             }
  937.  
  938.             if ( (n_GrowMethod==1) && (n_ShutterOpen==1) )
  939.             {
  940.                 n_PlantState = 2;
  941.             }
  942.             
  943.         }
  944.     }
  945.  
  946.     return;
  947. # ........................................................................
  948.  
  949. FlowerCloseup:
  950.  
  951.     # Create new plant off camera so it doesn't pop in
  952.     if (t_PlantNew == -1)
  953.     {
  954.         t_PlantNew = CreateThing(t_plantType0[n_PlantState], t_PlantCurrent);
  955.         AttachThingToThingEx(t_PlantNew, pot, 0x08);
  956.         CaptureThing(t_PlantNew);
  957.         SetThingLight(t_PlantNew, '1 1 1', .01, 0);
  958.         SetThingAlpha(t_PlantNew, 0.0);
  959.     }
  960.  
  961.     # Music...
  962.     PlaySoundLocal(music4, 1.0, 0, 0x0000, 0);
  963.  
  964.     # prep camera
  965.     SetCameraLookInterp(2, 0); # kill pan & tilt mode
  966.     Sleep(.01);
  967.     SetCameraFocus(2, closeupcam_1);
  968.     if (n_PlantState == 1)
  969.     {
  970.         SetCameraSecondaryFocus(2, close_ct_1);
  971.         SetCameraFOV(50, 0, 0.0);
  972.     }
  973.     else
  974.     {
  975.         SetCameraSecondaryFocus(2, close_ct_2);
  976.         SetCameraFOV(50, 0, 0.0);    
  977.     }
  978.  
  979.     # Check if bulb in pot
  980.     if (n_PlantInPot == 0 )
  981.         return;
  982.  
  983.     # pan up to show growth
  984.     SetCameraLookInterp(2, 1);         # yes pan & tilt mode
  985.     SetCameraInterpSpeed(2, 2.5);      # same amount of time as fade in
  986.     Sleep(.01);
  987.  
  988.     # Fade out current plant, fade in new
  989.     ThingFadeAnim(t_PlantCurrent, 1.0, 0.0, 5.0, 0);
  990.     ThingFadeAnim(t_PlantNew, 0.0, 1.0, 3.0, 0);
  991.  
  992.     # check plant state for camera target
  993.     if (n_PlantState == 1)
  994.     {
  995.         SetCameraSecondaryFocus(2, close_ct_2);
  996.         SetCameraFOV(45, 1, 2.5);
  997.     }
  998.     else
  999.     {
  1000.         SetCameraSecondaryFocus(2, close_ct_3);
  1001.         SetCameraFOV(53, 1, 2.5);
  1002.  
  1003.         # We're in the bud state -- puzzle solved
  1004.         b_Solved = 1;
  1005.     }
  1006.  
  1007.     # RT: Make some fairy dust
  1008.     for (n_idx = 0; n_idx < 8; n_idx = n_idx + 1)
  1009.     {
  1010.         curSector = GetThingSector(t_PlantCurrent);
  1011.         thingPos = GetThingPos(t_PlantCurrent);
  1012.         createPos = VectorAdd(thingPos, '0.0 0.0 0.008');
  1013.         CreateThingAtPos(t_FairyDust, curSector, createPos, '0 0 0');
  1014.         Sleep(0.2);
  1015.     }
  1016.  
  1017.     Sleep(2.0);
  1018.  
  1019.     return;
  1020.  
  1021. # ........................................................................
  1022.  
  1023. LowerPot:
  1024.  
  1025.     # Make sure nothing gets stuck on the way down
  1026.     SetCollideType(pot_topchain_a, 0);
  1027.     SetCollideType(pot_topchain_b, 0);
  1028.     SetCollideType(pot_botchain_a, 0);
  1029.     SetCollideType(pot_botchain_b, 0);
  1030.     SetCollideType(pot_top, 0);
  1031.     SetCollideType(pot_upperchain, 0);
  1032.  
  1033.     AttachThingToThing(pot_ct_1, pot);
  1034.  
  1035.     # make parts visible
  1036.     ClearThingFlags(pot_topchain_a,0x80000);
  1037.     ClearThingFlags(pot_topchain_b,0x80000);
  1038.     ClearThingFlags(pot_top,0x80000);
  1039.     ClearThingFlags(pot_upperchain,0x80000);
  1040.  
  1041.     # Actor on...
  1042.     SetThingFlags(t_player, 0x80000);
  1043.     ClearThingFlags(flower_indy, 0x80000);
  1044.  
  1045.     # cut to behind chains
  1046.     SetCameraLookInterp(2, 0); # no p & t
  1047.     SetCameraPosInterp(2, 0); # no dolly
  1048.     SetCameraFocus(2, potcam_1);
  1049.     SetCameraSecondaryFocus(2, pot_ct_1);
  1050.     SetCurrentCamera(2);
  1051.     SetCameraFOV(90, 0, 0.0); # reset FOV just in case
  1052.  
  1053.     # Bulb goes in pot
  1054.     AISetLookThing(flower_indy, pot);
  1055.     PlayKey(flower_indy, in_putbud, 4, 0x12, 1); # Indy places bulb in pot
  1056.  
  1057.     # pot descends
  1058.     SkipToFrame(pot, 0, 1.5);
  1059.  
  1060.     # loop the sound
  1061.     potloop = PlaySoundLocal(pot_move, 1.0, 0, 0x1, 0);
  1062.     PlaySoundLocal(music2, 1.0, 0, 0x0000, 0);
  1063.  
  1064.     # camera moves forward to look down
  1065.     SetCameraPosInterp(2, 1);  #yes dolly
  1066.     SetCameraInterpSpeed(2, 2.5);
  1067.     sleep(.01);
  1068.     SetCameraFocus(2, potcam_2);
  1069.     SetCameraSecondaryFocus(2, pot_ct_1);
  1070.     sleep(4.0);
  1071.  
  1072.     # cut to below, pot already past opening
  1073.     SetCameraPosInterp(2, 0); # no dolly
  1074.     sleep(.01);
  1075.     SetCameraFocus(2, potcam_3);
  1076.     SetCameraSecondaryFocus(2, pot_ct_1);
  1077.     SetCameraFOV(70, 1, 3.0);
  1078.  
  1079.     # track pot to pool
  1080.     WaitForStop(pot);
  1081.     StopSound(potloop, 0.0);
  1082.     PlaySoundLocal(statue_stop, 1.0, 0, 0x0, 0);
  1083.     sleep(.5);
  1084.     DetachThing(pot_ct_1);
  1085.  
  1086.     SetCollideType(pot_topchain_a, 3);
  1087.     SetCollideType(pot_topchain_b, 3);
  1088.     SetCollideType(pot_botchain_a, 3);
  1089.     SetCollideType(pot_botchain_b, 3);
  1090.     SetCollideType(pot_top, 3);
  1091.     SetCollideType(pot_upperchain, 3);
  1092.  
  1093.     n_PotLowered = 1;
  1094.  
  1095.     return;
  1096.  
  1097. # ........................................................................
  1098.  
  1099. NoMove:
  1100.  
  1101.     # Swing camera around
  1102.     SetExtCamLookOffset('0.0 0.02 -0.01');
  1103.     SetExtCamOffset(VectorSet((0.25 * pushType), -0.05, 0.1));
  1104.  
  1105.     # Adjust player
  1106.     TeleportThing(t_player, pushGhost0[pushPosition]);
  1107.     #DEBUGFLEX(pushPosition, "Teleporting to start position");
  1108.  
  1109.     # Play no-move animation
  1110.     PlayKey(t_player, in_nomove, 4, 0x12, 1);
  1111.  
  1112.     # Housekeeping...
  1113.     ClearActorFlags(t_player, 0x200000);
  1114.     RestoreExtCam();
  1115.     EndCutscene();
  1116.  
  1117.     return;
  1118.  
  1119. # ........................................................................
  1120.  
  1121. ShowGate:
  1122.     
  1123.     # cut to shot of indy rotating statue
  1124.     SetCameraPosInterp(2, 0); # no dolly
  1125.     SetCameraLookInterp(2, 0); # kill pan & tilt mode
  1126.     SetCameraFocus(2, statuecam_2);
  1127.     SetCameraSecondaryFocus(2, statue_ct_2);
  1128.     SetCurrentCamera(2);
  1129.     SetCameraFOV(70, 0, 0.0);
  1130.  
  1131.     # Wait for push anim to finish
  1132.     Playkey(statue_indy, in_pushstatue, 4, 0x12, 1);
  1133.  
  1134.     TeleportThing(statue_indy, nextPositionGhost);
  1135.  
  1136.     # move gate
  1137.     MoveToFrame(gate, 1, 0.8);
  1138.  
  1139.     # Indy looks toward gate
  1140.     SetThingMaxRotVel(statue_indy, 75.0);
  1141.     AISetLookThing(statue_indy, gate);
  1142.  
  1143.     # Interp to gate
  1144.     SetCameraPosInterp(2, 1); # yes dolly
  1145.     SetCameraLookInterp(2, 1); # yes pan & tilt mode
  1146.     SetCameraInterpSpeed(2, 2.5);
  1147.     sleep(.01);
  1148.     SetCameraFocus(2, statuecam_2a);
  1149.     SetCameraSecondaryFocus(2, statue_ct_2a);
  1150.     #Sleep(2.0);
  1151.  
  1152.     # Wait for gate to stop
  1153.     WaitForStop(gate);
  1154.     Sleep(.5);        # beat
  1155.  
  1156.     # return control
  1157.     SetThingFlags(statue_indy, 0x80000);
  1158.     TeleportThing(t_player, nextPositionGhost);
  1159.     ClearThingFlags(t_player, 0x80000);
  1160.     ClearActorFlags(t_player, 0x200000);
  1161.     SetCameraLookInterp(2, 0); # kill pan & tilt mode
  1162.     SetCameraPosInterp(2, 0); # kill dolly mode
  1163.     Sleep(0.01);
  1164.     ResetCameraFOV(0, 0.0);
  1165.     SetCameraPosition(1, endCamPos);    # prep for camera to swing back
  1166.     SetCurrentCamera(curCam);
  1167.     EndCutscene();
  1168.     bCutsceneRunning = 0;
  1169.  
  1170.     return;
  1171.  
  1172. # ........................................................................
  1173.  
  1174. WaterOn:
  1175.  
  1176.     # cut to shot of indy rotating statue
  1177.     SetCameraPosInterp(2, 0); # no dolly
  1178.     SetCameraLookInterp(2, 0); # kill pan & tilt mode
  1179.     SetCameraFocus(2, statuecam_1);
  1180.     SetCameraSecondaryFocus(2, statue_ct_1a);
  1181.     SetCurrentCamera(2);
  1182.     SetCameraFOV(80, 0, 0);
  1183.  
  1184.     # play music, monks chanting
  1185.     PlaySoundLocal(music3, 1.0, 0, 0x0000, 0);
  1186.  
  1187.     # Wait for push anim to finish
  1188.     Playkey(statue_indy, in_pushstatue, 4, 0x12, 1);
  1189.  
  1190.     TeleportThing(statue_indy, nextPositionGhost);
  1191.  
  1192.     # Make indy look at water
  1193.     SetThingMaxRotVel(statue_indy, 75.0);
  1194.     AISetLookThing(statue_indy, plant_Mark2);
  1195.  
  1196.     # make puddle sound
  1197.     for (n_idx = 0; n_idx < 3; n_idx = n_idx + 1)
  1198.     {
  1199.         SetSurfaceFlags(wet_snd_0[n_idx], 0x40000);
  1200.     }
  1201.  
  1202.     # make water surface visible
  1203.     for (n_idx = 0; n_idx < 14; n_idx = n_idx + 1)
  1204.     {
  1205.         SetFaceGeoMode(wet_surf_0[n_idx], 4);
  1206.     }
  1207.  
  1208.     # pan to show water in cistern
  1209.  
  1210.     h2oloop=PlaySoundLocal(h2o_on, 1.0, 0, 0x1, 0); # water sound
  1211.     Sleep(.5);    # pause for sound before pan
  1212.     SetCameraPosInterp(2, 1);
  1213.     SetCameraLookInterp(2, 1); # yes pan & tilt mode
  1214.     SetCameraInterpSpeed(2, 4.5);
  1215.     Sleep (.01);
  1216.     SetCameraFocus(2, statuecam_1a);
  1217.     SetCameraSecondaryFocus(2, statue_ct_1b);
  1218.     SetCameraFOV(65, 1, 4.5);
  1219.  
  1220.     Sleep(5.5);     # allow for camera to move to spot
  1221.     StopSound(h2oloop, 0.0);
  1222.  
  1223.     # cut to pot -- prep camera
  1224.     ResetCameraFOV(0, 0.0);
  1225.     SetCameraPosInterp(2, 0); # no dolly
  1226.     SetCameraLookInterp(2, 0); # kill pan & tilt mode
  1227.     SetCameraFocus(2, potcam_6);
  1228.     SetCameraSecondaryFocus(2, pot);
  1229.     Sleep (.01);
  1230.  
  1231.     # Make sure nothing gets stuck on the way down
  1232.     SetCollideType(pot_topchain_a, 0);
  1233.     SetCollideType(pot_topchain_b, 0);
  1234.     SetCollideType(pot_botchain_a, 0);
  1235.     SetCollideType(pot_botchain_b, 0);
  1236.     SetCollideType(pot_top, 0);
  1237.     SetCollideType(pot_upperchain, 0);
  1238.  
  1239.     # pot moves to useable spot
  1240.     SetCameraFOV(70, 1, 2.0);
  1241.     MoveToFrame(pot, 2, 1.0);
  1242.  
  1243.     # loop the sound
  1244.     potloop=PlaySoundLocal(pot_move, 1.0, 0, 0x1, 0);
  1245.     PlaySoundThing(h2o_on, waterONpos, 0.5, 2, 10, 0x881);
  1246.     
  1247.  
  1248.     WaitForStop(pot);
  1249.     StopSound(potloop, 0.0);
  1250.     PlaySoundLocal(statue_stop, 1.0, 0, 0x0, 0);
  1251.     Sleep(1.0);
  1252.  
  1253.     # Give collision
  1254.     SetCollideType(pot_topchain_a, 3);
  1255.     SetCollideType(pot_topchain_b, 3);
  1256.     SetCollideType(pot_botchain_a, 3);
  1257.     SetCollideType(pot_botchain_b, 3);
  1258.     SetCollideType(pot_top, 3);
  1259.     SetCollideType(pot_upperchain, 3);
  1260.  
  1261.     # Cleanup
  1262.     SetThingMaxRotVel(statue_indy, in_rotRate);# reset indy rotate velocity
  1263.     SetThingFlags(statue_indy, 0x80000);
  1264.     TeleportThing(t_player, nextPositionGhost);
  1265.     ClearThingFlags(t_player, 0x80000);
  1266.     ClearActorFlags(t_player, 0x200000);
  1267.     
  1268.     # "...some kind of switch"
  1269.     PlayVoice(t_player, in_clue, 1, 0);
  1270.     
  1271.     SetCameraLookInterp(2, 0); # kill pan & tilt mode
  1272.     SetCameraPosInterp(2, 0); # kill dolly mode
  1273.     Sleep(0.01);
  1274.     ResetCameraFOV(0, 0.0);
  1275.     SetCameraPosition(1, endCamPos);    # prep for camera to swing back
  1276.     SetCurrentCamera(curCam);
  1277.     ResetCameraFOV(0, 0.0);
  1278.     EndCutscene();
  1279.     bCutsceneRunning = 0;
  1280.  
  1281.     return;
  1282.  
  1283. # ........................................................................
  1284.  
  1285. GetPotSide:
  1286.  
  1287.     # Useful stuff
  1288.     playerPos = GetThingPos(t_player);
  1289.     thingPos = GetThingPos(pot);
  1290.  
  1291.     # See which side of the pot Indy is on...
  1292.     indyVector = VectorNorm(VectorSub(thingPos, playerPos));
  1293.     dotProduct = VectorDot(GetThingLVec(pot), indyVector);
  1294.     if (dotProduct > 0) pickupSide = 0; # In front of pot 
  1295.     else pickupSide = 1; # In water
  1296.  
  1297.     return;
  1298.  
  1299. # ..............................................................................
  1300.  
  1301. randlocationlines:
  1302.  
  1303.     Print("locationlines");
  1304.     
  1305.     while (l_newline == l_oldline)
  1306.     {        
  1307.         l_newline = RandBetween(0, 5);
  1308.     }
  1309.     l_oldline = l_newline;
  1310.     
  1311.     cursound = PlayVoice(t_player, in_wrongspot0[l_newline], 1, 0);
  1312.  
  1313.     doplay = Randbetween(0, 2);
  1314.     if ((doplay == 0) || (played == 0))
  1315.     {
  1316.         Print("playing key...");
  1317.         PlayKey(t_player, in_bothup, 4, 0x12, 0);
  1318.         played = 1;
  1319.     }
  1320.     WaitForSound(cursound);
  1321.  
  1322.     return;
  1323.  
  1324. # ..............................................................................
  1325.  
  1326. end
  1327.